from _cfg import base as cfg

from hander.HanderCodeName import HanderCodeName
import os
from  dingding import  dingding
# 1.插入数据库
# 2.查询是否已经插入,数据库中存在记录
# 3.如果没有插入则插入数据
# 4.获取source目录下的全部文件名称


if __name__ == '__main__':

    # codefile = './source/sz_code_20210527.csv'

    CODE_NAME_DIR = './source/tdx/'
    files = os.walk(CODE_NAME_DIR)  # 获取文件夹下的所有文件

    codeName=HanderCodeName(cfg)
    for root, _, file in files:
        for f in file:
            codefile = os.path.join(root, f)
            # print(codefile)
            codeName = HanderCodeName(cfg)
            codeName.setCodeFile(codefile)
            res = codeName.toDb()

    # print(res)
